package com.shou.lifecollege.modules.common.mapper;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.shou.lifecollege.modules.common.entity.SysRole;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Param;
import org.apache.ibatis.annotations.Select;

import java.util.List;

/**
 * @Author: luotian
 * @Date: 2022/11/24 12:44
 */
@Mapper
public interface SysRoleMapper extends BaseMapper<SysRole> {

    /**
     * 根据id 获取用户角色
     * @param id 用户id
     * @return
     */
    @Select("select sys_role.*  from sys_usr_role left join sys_role on sys_usr_role.roleid = sys_role.id where sys_usr_role.usrid=#{id};")
    List<SysRole> getRoleByUserId(@Param("id") String id);

}
